function ResProd=calc_res_prod(A_t, M_t,TractSunlightProfile)

global nhours nnerc PV tract_nerc_xxwalk  tract_nerc_xxwalk_mat

A_t_year=A_t./PV; %KWH per panel by one panel in given tract over the year

ResProdTractYear=A_t_year.*M_t; % number of panels in tract times total production over the year. (ntract*1)

%ResProdTractHourly=(ResProdTractYear*ones(1,nhours)).*TractSunlightProfile; % ntract*nhours

ResProdTractHourly=(ResProdTractYear).*TractSunlightProfile; % ntract*nhours

%convert to ntract*nnerc


ResProd=ResProdTractHourly'*tract_nerc_xxwalk_mat;

ResProd=ResProd./1000; %convert to mwh
